﻿@using ST = EmoneyWeiXinCommon.StringTools
@{
    ViewBag.Title = "NewsReport";
    Layout = null;
}

<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="dns-prefetch" href="//res.wx.qq.com">
    <link rel="dns-prefetch" href="//mmbiz.qpic.cn">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="shortcut icon" type="image/x-icon" href="http://res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/common/favicon22c41b.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta id="viewport" name="viewport" content="width=device-width, maximum-scale=1.0,user-scalable=no" />
    <meta name="format-detection" content="telephone=no" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="@ViewBag.strTitle" />
    <meta property="og:description" content="@ViewBag.strSummAry" />
    <meta property="og:image" content="@ViewBag.strImage" />
    <title>@ViewBag.strTitle</title>
    <!--[if lt IE 9]>    <link rel="stylesheet" type="text/css" href="@ST.GetTrendsFile("Static/css/muban.css")" />    <![endif]-->
    <link href="@ST.GetTrendsFile("Static/css/Stylezzd.css")" rel="stylesheet" />
    <script src="@ST.GetTrendsFile("Static/Js/jquery-1.7.1.min.js")"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
</head>
<body id="activity-detail">
    <div class="rich_media">
        <div class="rich_media_inner">
            <h2 id="activity-name" class="rich_media_title">@ViewBag.strTitle</h2>
            <div class="rich_media_meta_list">
                <em id="post-date" class="rich_media_meta text">@ViewBag.strdatetime</em>
                <em class="rich_media_meta text">@ViewBag.Author</em>
                <a id="post-user" class="rich_media_meta link nickname" href="@ViewBag.clickUrl">@ViewBag.weixinName</a>
            </div>
            <div id="page-content">
                <div id="img-content">
                    <div id="js_content" class="rich_media_content">
                        <div style="margin-top: 35px;">
                            <img style="white-space: normal; visibility: visible !important; word-wrap: break-word !important; box-sizing: border-box !important;" src="@Url.Content("~/Static/Image/mmbizgif.gif")" data-w="640" data-ratio="0.11875" >
                        </div>
                        @Html.Raw(ViewBag.contentym)
                        @Html.Raw(ViewBag.strContent)
                        @Html.Raw(ViewBag.contentyj)
                    </div>
                    <div id="js_toobar" class="rich_media_tool">
                        <a id="js_report_article" class="media_tool_meta link_primary meta_extla" href="javascript:void(0);">阅读 @ViewBag.newsreportnum</a>
                        &nbsp;<a id="dzan" href="javascript:void(0);">@Html.Raw(ViewBag.strUserzan)</a>
                        <a class="media_tool_meta link_primary meta_extra" href="javascript:void(0);">举报</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

<script type="text/javascript">
    $(window).ready(function () {

        if ('@ViewBag.weixinid'!= '8') {
            $("#jiaqunLianjie").hide();
        }

        $("#dzan").click(function () {
            $.ajax({
                type: "get",
                url: "@ST.GetTrendsFile("WXOpen/ZanUser")" + "?random=" + Math.random(),
                async: true,
                data: { fn: "@ViewBag.fromUser", newsid: "@ViewBag.newsreportid" },
                dataType: "html",
                success: function (result) {
                    var src = $("#dzan").find("img").attr("src");
                    if (src.indexOf("Image/zan1.png") > 0) {
                        $("#dzan").html("<img src=\"@ST.GetStaticFile("Static/Image/zan2.png")\" style=\"height: 13px;\" />&nbsp;" + result);
                    }
                    else {
                        $("#dzan").html("<img src=\"@ST.GetStaticFile("Static/Image/zan1.png")\" style=\"height: 13px;\" />&nbsp;" + result);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert("error");
                }
            });
        })
    });
</script>

<script>
    var imgUrl = '@ViewBag.strImage';
    var lineLink = '@Html.Raw(ViewBag.strlinkUrl)';
    var descContent = "@ViewBag.strSummAry";
    var shareTitle = '@ViewBag.strTitle';
    var appid = '@ViewBag.strAppid';

    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '@ViewBag.strAppid', // 必填，公众号的唯一标识
        timestamp: '@ViewBag.timestamp', // 必填，生成签名的时间戳
        nonceStr: '@ViewBag.nonceStr', // 必填，生成签名的随机串
        signature: '@ViewBag.signature',// 必填，签名，见附录1
        jsApiList: ['checkJsApi',
                    'onMenuShareTimeline',
                    'onMenuShareAppMessage',
                    'onMenuShareQQ',
                    'onMenuShareWeibo',
                    'hideMenuItems',
                    'showMenuItems',
                    'hideAllNonBaseMenuItem',
                    'showAllNonBaseMenuItem',
                    'translateVoice',
                    'startRecord',
                    'stopRecord',
                    'onRecordEnd',
                    'playVoice',
                    'pauseVoice',
                    'stopVoice',
                    'uploadVoice',
                    'downloadVoice',
                    'chooseImage',
                    'previewImage',
                    'uploadImage',
                    'downloadImage',
                    'getNetworkType',
                    'openLocation',
                    'getLocation',
                    'hideOptionMenu',
                    'showOptionMenu',
                    'closeWindow',
                    'scanQRCode',
                    'chooseWXPay',
                    'openProductSpecificView',
                    'addCard',
                    'chooseCard',
                    'openCard']
    });


    wx.ready(function () {
        //分享给朋友
        wx.onMenuShareAppMessage({
            title: shareTitle, // 分享标题
            desc: descContent, // 分享描述
            link: lineLink, // 分享链接
            imgUrl: imgUrl, // 分享图标
            type: "link", // 分享类型,music、video或link，不填默认为link
            dataUrl: "", // 如果type是music或video，则要提供数据链接，默认为空
            success: function (res) {
                //alert(JSON.stringify(res));
                GetShare("AppMessage");
            },
            cancel: function () {
                //alert("用户取消分享后执行的回调函数");
            },
            fail: function (res) {
                //alert(JSON.stringify(res));
            }
        });
        //分享到朋友圈
        wx.onMenuShareTimeline({
            title: shareTitle,
            link: lineLink,
            imgUrl: imgUrl,
            trigger: function (res) {
                //alert('用户点击分享到朋友圈');
            },
            success: function (res) {
                //alert('朋友圈以分享');
                GetShare("Timeline");
            },
            cancel: function (res) {
                //alert('朋友圈以取消');
            },
            fail: function (res) {
                //alert(JSON.stringify(res));
            }
        });

        //分享到QQ
        wx.onMenuShareQQ({
            title: shareTitle,
            desc: descContent,
            link: lineLink,
            imgUrl: imgUrl,
            trigger: function (res) {
                //alert('用户点击分享到QQ');
            },
            complete: function (res) {
                //alert(JSON.stringify(res));
            },
            success: function (res) {
                GetShare("QQ");
            },
            cancel: function (res) {
                //alert('已取消');
            },
            fail: function (res) {
                //alert(JSON.stringify(res));
            }
        });
        //分享到微博
        wx.onMenuShareWeibo({
            title: shareTitle,
            desc: descContent,
            link: lineLink,
            imgUrl: imgUrl,
            trigger: function (res) {
                //alert('用户点击分享到微博');
            },
            complete: function (res) {
                //alert(JSON.stringify(res));
            },
            success: function (res) {
                //alert('已分享');
                GetShare("Weibo");
            },
            cancel: function (res) {
                //alert('已取消');
            },
            fail: function (res) {
                //alert(JSON.stringify(res));
            }
        });


    });

    wx.error(function (res) {
        //alert(res);
    });

    $(window).ready(function () {
        var srcList = new Array();
        $("#js_content img").each(function (n, i) {
            srcList.push($(this).attr("src"));
        });
        $("#js_content img").click(function () {
            wx.previewImage({
                current: $(this).attr("src"),
                urls: srcList
            });
        });
    })

    function GetShare(memuName) {
        $.ajax({
            url: "@Url.Action("ReceiptShare", "DailyTask2")",
            type: "post",
            data: { openid: "@ViewBag.fromUser", reportId: "@Request.QueryString["id"]", weixinId: "@ViewBag.weixinid" },
            success: function (data) {

            }
        });
    }
</script>
